package com.zr.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.zr.dao.BaseDao;
import com.zr.dao.VanDao;
import com.zr.datamodel.VanDM;
import com.zr.service.VanService;

import net.sf.json.JSONObject;
@Service("vanService")
public class VanServerImpl implements VanService{
	@Resource
	private BaseDao<VanDM> baseDao;
	@Resource
	private VanDao<VanDM>  vanDao;
	//页面数据展示
	@Override
	public JSONObject showVan(int page, int rows) {
		// TODO Auto-generated method stub
		JSONObject jso=new JSONObject();
		jso.put("total", vanDao.showCarCount());
		jso.put("rows", vanDao.showCarMsg(page, rows));
		
		return jso;
	}
	//增加车辆
	@Override
	public boolean addVan(String car_type, int car_status) {
		// TODO Auto-generated method stub
		boolean flag=false;
			flag=vanDao.addVan(car_type, car_status);
		return flag;
	}
	//编辑车辆
	@Override
	public boolean updateVan(String car_type, int car_status, int id) {
		// TODO Auto-generated method stub
		boolean flag=false;
		flag=vanDao.updateVan(car_type, car_status, id);
		return flag;
	}
	@Override
	public boolean deleteVan(String[] ids) {
		// TODO Auto-generated method stub
		boolean flag=false;
		for (int i = 0; i < ids.length; i++) {
			flag=vanDao.deleteVan(Integer.valueOf(ids[i]));
		}
		return flag;
	}

}
